<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>分类列表</title>
<link rel="stylesheet" href="../styles/backstage.css">
</head>
<body>
<div class="details">
                    <div class="details_operation clearfix">
                        <div class="bui_select">
                            <input type="button" value="添&nbsp;&nbsp;加" class="add"  onclick="addCate()">
                        </div>
                    </div>
                    <!--表格-->
                    <table class="table" cellspacing="0" cellpadding="0">
                        <thead>
                            <tr>
                                <th width="15%">编号</th>
                                <th width="25%">分类</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                        <?php while($row = mysql_fetch_assoc($res)):?>
                            <tr align="center">
                                <!--这里的id和for里面的c1 需要循环出来-->
                                <td><?php echo $row['id'];?></td>
                                <td><?php echo $row['name'];?></td>
                                <?php echo"<td align='center'><input type='button' value='修改' class='btn' onclick='editCate({$row['id']})'><input type='button' value='删除' class='btn'  onclick='delCate({$row['id']})'></td>";?>
                            </tr>
                        <?php endwhile;?>
                        </tbody>
                    </table>
                </div>
<script type="text/javascript">
	function editCate(id){
		window.location="./editCate.php?id="+id;
	}
	function delCate(id){
		if(window.confirm("您确定要删除吗？删除之后不能恢复哦！！！")){
			window.location="./delCate.php?id="+id;
		}
	}
	function addCate(){
		window.location="./addCate.php";
	}
</script>
</body>
</html>